#include "titlebar.h"
#include "ui_titlebar.h"

TitleBar::TitleBar(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::TitleBar)
{
    ui->setupUi(this);

    connect(ui->btExit, SIGNAL(clicked()), SIGNAL(close()));
    connect(ui->btMin, SIGNAL(clicked()), SIGNAL(minimize()));
}

TitleBar::~TitleBar()
{
    delete ui;
}

void TitleBar::changeEvent(QEvent *e)
{
    QWidget::changeEvent(e);
    switch (e->type()) {
    case QEvent::LanguageChange:
        ui->retranslateUi(this);
        break;
    default:
        break;
    }
}

void TitleBar::showMinimize(bool value)
{
    ui->btMin->setVisible(value);
}

void TitleBar::showClose(bool value)
{
    ui->btExit->setVisible(value);
}
